#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
using namespace std;
int n, m;
const int N = 1e3 + 10;
int arr[N][N];
double av1[N];
double av2[N];
int main()
{
	while(scanf("%d%d",&n,&m)!=EOF) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cin >> arr[i][j];
			}
		}
		memset(av1, 0, sizeof(av1));
		memset(av2, 0, sizeof(av2));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				av1[i] += arr[i][j];
			}
			av1[i] = av1[i] * 1.0 / m;
			if (i == 0) {
				/*cout << fixed << setprecision(2) << av1[i];*/
				printf("%.2lf", av1[i]);
			}
			else {
				//cout << " " << fixed << setprecision(2) << av1[i];
				printf(" %.2lf", av1[i]);
			}
		}
		cout << endl;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				av2[i] += arr[j][i];
			}
			av2[i] = av2[i] * 1.0 / n;
			if (i == 0) {
				//cout << fixed << setprecision(2) << av2[i];
				printf("%.2lf", av2[i]);
			}
			else {
				//cout << " " << fixed << setprecision(2) << av2[i];
				printf(" %.2lf", av2[i]);
			}
		}
		cout << endl;
		int count = 0;
		for (int i = 0; i < n; i++) {
			bool flag = 1;
			for (int j = 0; j < m; j++) {
				if (arr[i][j] < av2[j]) {
					flag = 0;
					break;			
				}
			}
			if (flag) {
				count++;
			}
		}
		cout << count << endl;
		cout << endl;
	}
	return 0;
}